package com.donquijote.simple;

/**
 * @author 421527548@qq.com
 * @version V1.0
 * @title
 * @description
 * @date 2022-11-14 10:03
 */
public class WeaponFactory  {
    /**
    * @Author E-Mail: 421527548@qq.com
    * @Describtion: 静态工厂，需要什么产品就传递什么参数，传递TANK获取坦克
    * @Date: 10:06 2022/11/14
    * @Params:
    * @Return:
    */
    public static Weapon get(String weaponType){
        if ("TANK".equals(weaponType)) {
            return new Tank();
        }else if ("BOOM".equals(weaponType)){
            return new Boom();
        }else if ("FIGHTER".equals(weaponType)){
            return new Fighter();
        }else {
            throw  new RuntimeException("不支持该类型产品");
        }
    }
}
